#include "algostuff.h"
using namespace std;

void accumulate1()
{
	vector<int> coll;

	INSERT_ELEMENTS(coll, 1, 9);
	PRINT_ELEMENTS(coll);

	// process sum of elements
	cout << "sum: "
		<< accumulate(coll.cbegin(), coll.cend(), 0) << endl;

	// process sum of elements less 100
	cout << "sum: "
		<< accumulate(coll.cbegin(), coll.cend(), -100) << endl;

	// process product of elements
	cout << "product: "
		<< accumulate(coll.cbegin(), coll.cend(), 1, multiplies<int>())
		<< endl;

	// process product of elements
	cout << "product: "
		<< accumulate(coll.cbegin(), coll.cend(), 0, multiplies<int>())
		<< endl;
}